<?php
/**
 * Created by PhpStorm.
 * Author: 东东 < 282756287@qq.com >
 * 接口控制器基类
 */
namespace app\common\controller;

class Api extends Base
{
    protected $page =1;
    protected $limit =10;
    protected $userId = 0;                        //用户id

    protected function initialize()
    {
        error_reporting(E_ERROR | E_WARNING | E_PARSE);
        parent::initialize();
        $this->page = input('page')?input('page'):$this->page;
        $this->limit = input('limit')?input('limit'):$this->limit;
        //配置统一入口，只让访问init方法
        if(request()->module()!= 'api' && request()->controller() != 'Index' && request()->action() != 'index'){
            die('error');
        }


    }

    //此方法用于设置参数
    public function setInit($user_id)
    {
        $this->userId = $user_id;
        return true;
    }
}
